package com.tongcao.cn.task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author:tongcao
 * @Date:2018/8/25 17:24
 * Description:
 */
@Slf4j
@Component
public class MyTask1 implements Task {


    /**
     * 子类实现
     * 每十秒执行一次
     */
    @Scheduled(cron = "0 * 5 * * ? ")
    @Override
    public void execute() {
        try {
            log.info("任务1执行开始。。。");
            Thread.sleep(1000L);
            log.info("任务1执行结束。。。");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
